package com.zyh.system.controller;

import com.zyh.system.dao.impl.MovieDaoImpl;
import com.zyh.system.domain.Movie;
import com.zyh.system.service.impl.MovieServiceImpl;

import java.util.Map;
import java.util.Scanner;

/**
 * @Author zyh
 * @Date 2024/8/1 18:52
 * @Description 观影指南管理器
 */

public class MovieIndex {
    public static final Scanner INPUT = new Scanner(System.in);
    public static final Map<Movie, Integer> MOVIE_MAP = MovieDaoImpl.MOVIE_MAP;
    public static final MovieServiceImpl MOVIE_SERVICE = new MovieServiceImpl();

    public void showIndex() {
        while (true) {
            System.out.println("欢迎使用观影指南管理器");
            System.out.println("1.添加电影");
            System.out.println("2.查看电影");
            System.out.println("3.显示人气最高电影");
            System.out.println("4.其他：退出系统");
            System.out.println("请选择：");
            int choice = INPUT.nextInt();
            switch (choice) {
                case 1://添加电影
                    MOVIE_SERVICE.add(MOVIE_MAP);
                    break;
                case 2://查看电影
                    MOVIE_SERVICE.showMovieInfo(MOVIE_MAP);
                    break;
                case 3://显示人气最高电影
                    MOVIE_SERVICE.showMax(MOVIE_MAP);
                    break;
                default:
                    System.out.println("系统退出！");
                    System.exit(0);
            }
        }
    }
}
